<template>
  <div class="page-department">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>申请列表
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <div class="component-searchHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont" style="font-weight:700;margin-right:3px;">&#xe63d;</span>筛选查询
          </p>
          <div class="right">
            <button @click="dataInit">查询</button>
          </div>
        </div>
      </div>
    </div>
    <div class="component-search-box">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="输入搜索：">
          <el-input v-model="formInline.num" placeholder="采购单号"></el-input>
        </el-form-item>
        <el-form-item label="申请人：">
          <el-input v-model="formInline.people" placeholder="申请人"></el-input>
        </el-form-item>
      </el-form>
    </div>
    <!-- 表格 -->
    <div class="component-listHeader">
      <div class="search-header">
        <div class="left-title">
          <p class="left-text">
            <span class="iconfont">&#xe61e;</span>
            申请列表
          </p>
          <div class="right"></div>
        </div>
      </div>
    </div>

    <div class="table">
      <el-table ref="multipleTable" :data="info" tooltip-effect="dark" style border>
        <el-table-column label="采购单号" align="center" width="200" prop="num"></el-table-column>
        <el-table-column label="申请人" align="center" width="240" prop="people"></el-table-column>
        <el-table-column label="申请总价" align="center" width="250" prop="total"></el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <a @click.prevent="check(scope.row)"  style="margin-right:20px;">查看详情</a>
            <a @click.prevent="idea(scope.row)">审批意见</a>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="component-paging" v-if="info.length > 0">
      <div class="table-bottom">
        <div class="bottom-left"></div>
        <div class="paging">
          <div class="paging-left">
            <p>
              共
              <span>{{Math.ceil(total/pageSize)}}</span> 页/
              <span>{{total}}</span> 条数据
            </p>
          </div>
          <el-pagination
            background
            @size-change="SizeChange($event,dataInit,currentPage,pageSize)"
            @current-change="CurrentChange($event,dataInit,currentPage,pageSize)"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30]"
            :page-size="pageSize"
            layout="sizes, prev, pager, next, jumper"
            :total="total"
          ></el-pagination>
        </div>
      </div>
    </div>
    <div class="component-model">
      <el-dialog title="申请详情" :visible.sync="model1" width="800px">
        <div>
          <div class="table">
            <el-table ref="multipleTable" :data="modelInfo" tooltip-effect="dark" style border>
              <el-table-column label="序号" align="center" width="120" prop="num"></el-table-column>
              <el-table-column label="材料名称" align="center" prop="name"></el-table-column>
              <el-table-column label="型号" align="center" width="180" prop="type"></el-table-column>
              <el-table-column label="采购数量" align="center" width="170" prop="price"></el-table-column>
              <el-table-column label="单价" align="center" width="170" prop="price"></el-table-column>
            </el-table>
          </div>
          <div class="total">
            <p>总价：{{'20020.00'}}</p>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="model1 = false">确定</el-button>
        </span>
      </el-dialog>
      <el-dialog title="审核意见" :visible.sync="model2" width="600px">
        <div class="hadRadio">
          <el-form
            ref="form"
            :model="modelform"
            label-width="100px"
            style="width:300px;margin:0 auto;"
          >
            <el-form-item label="审核意见：">
              <el-radio-group v-model="modelform.idea" style="margin-left:-30px;">
                <el-radio label="同意"></el-radio>
                <el-radio label="驳回"></el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="备注：" style="width:300px;">
              <el-input type="textarea" v-model="modelform.remark" style="margin-left:20px;"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="model2 = false">取消</el-button>
          <el-button @click="model2 = false">确定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      modelInfo: [
        {
          num: "1",
          name: "1",
          type: "1",
          paper: "12",
          real: "123",
          price: "123",
          inside: "1",
          outside: "12"
        }
      ],
      info: [
        {
          num: "123123",
          people: "王二麻子",
          total: "100001"
        }
      ],
      formInline: {
        num: "",
        people: ""
      },
      // 数据总条数
      total: 0,
      // 每页显示数据的条数
      pageSize: 10,
      // 当前显示的页面页码
      currentPage: 1,
      model1: false,
      model2: false,
      modelform: {
        idea: "",
        remark: ""
      }
    };
  },
  mounted() {},
  methods: {
    dataInit() {},
    check() {
      this.model1 = !this.model1;
    },
    idea() {
      this.model2 = !this.model2;
    }
  }
};
</script>

<style scoped>
.component-searchHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
}

.component-searchHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-searchHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-searchHeader .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 30px;
}

.component-search-box {
  width: 1100px;
  height: 60px;
  box-sizing: border-box;
  background-color: #fff;
  border: 1px solid #e4e4e4;
  border-top: none;
  margin: 0 auto;
  text-align: left;
  padding-left: 30px;
  line-height: 60px;
}

.component-search-box .el-input__inner {
  height: 35px;
  display: inline-block;
}

.component-listHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
  border-bottom: 0;
}

.component-listHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-listHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  font-size: 14px;
  line-height: 45px;
  font-weight: 700;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-listHeader .search-header .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 10px;
}

.component-listHeader .search-header .right button {
  padding: 0 15px;
  height: 30px;
  width: 80px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 14px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-listHeader .search-header .right button:hover {
  background-color: #f3f3f3;
}

.table {
  width: 1100px;
  margin: 0 auto;
}

.el-table .cell a {
  color: #1abc9a;
  text-decoration: none;
  cursor: pointer;
}

.component-model .table {
  width: 750px;
  margin: 0 auto;
}

.component-model .total {
  width: 750px;
  margin: 0 auto;
}
.component-model .total p {
  width: 100%;
  text-align: right;
  color: #1abc9c;
  font-size: 16px;
  font-weight: 600;
  padding: 20px 20px 0;
  box-sizing: border-box;
}
</style>
